<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>购物返现设置</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
                <div class="layui-card-header">
                    {if !$info['id']}<i class="fa fa-plus"></i> 添加购物返现{else}<i class="fa fa-pencil"></i> 编辑购物返现{/if}
                    <i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
                </div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form form-label-w8" lay-filter="">
                        <input type="hidden" name="info[id]" value="{$info['id']}">


                        <div class="layui-form-item">
                            <label class="layui-form-label">活动名称：</label>
                            <div class="layui-input-inline" style="width:300px">
                                <input type="text" name="info[name]" value="{$info.name}" lay-verify="required" lay-verType="tips" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">返现比率：</label>
                            <div class="layui-input-inline" >
                                <input type="text" name="info[back_ratio]" value="{$info.back_ratio}"  class="layui-input">
                            </div>
                            <div class="layui-form-mid">%</div>
                        </div>
                        {if getcustom('cashback_receiver')}
                        <div class="layui-form-item" >
                            <label class="layui-form-label">受益人：</label>
                            <div class="layui-input-inline" style="width:250px">
                                <input type="radio" name="info[receiver_type]" value="1" {if !$info['id'] || $info['receiver_type']==1}checked{/if} title="自己" />
                                <input type="radio" name="info[receiver_type]" value="2" {if $info['receiver_type']==2}checked{/if} title="参与活动的人" />
                            </div>
                            <div class="layui-form-mid layui-word-aux"> 注：仅限单个指定商品 参与活动人平均分配，通过限额控制最大分配</div>
                        </div>
                        {/if}
                        {if getcustom('cashback_max')}
                        <div class="layui-form-item" >
                            <label class="layui-form-label">返现额度倍数：</label>
                            <div class="layui-input-inline" style="width:250px">
                                <input type="number" name="info[goods_multiple_max]" value="{$info.goods_multiple_max}"
                                       min="0"
                                       class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux"> 注：每人最高返现额度，仅限单个指定商品，商品售价的N倍（满额停止返现）0或空 不限制</div>
                        </div>
                        {/if}

                        <div class="layui-form-item" >
                            <label class="layui-form-label">返现类型：</label>
                            <div class="layui-input-inline" style="width:250px">
                                <input type="radio" name="info[back_type]" value="1" {if !$info['id'] || $info['back_type']==1}checked{/if} title="余额" />
                                <input type="radio" name="info[back_type]" value="2" {if $info['back_type']==2}checked{/if} title="佣金" />
                                <input type="radio" name="info[back_type]" value="3" {if $info['back_type']==3}checked{/if} title="积分" />
                            </div>
                            <div class="layui-form-mid layui-word-aux"> 注：确认收货后返还到用户的余额/佣金/积分账户</div>
                        </div>

                        {if getcustom('yx_cashback_time')}
                        <div class="layui-form-item" style="margin-bottom: 5px">
                            <label class="layui-form-label">返现时间：</label>
                            <div class="layui-input-inline" style="width:380px">
                                <input type="radio" name="info[return_type]" value="0" {if $info['return_type']==0}checked{/if} title="立即返还" lay-filter="return_type"/>
                                <input type="radio" name="info[return_type]" value="1" {if $info['return_type']==1}checked{/if} title="自定义" lay-filter="return_type"/>
                                <span style="display:{if $info['return_type']!=1}none{/if};" id="return_day"><input type="text"  name="info[return_day]"  value="{$info.return_day}" class="layui-input" style="display: inline-block;width: 100px;" > 天返还完</span>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label"></label>
                            <div class="layui-input-inline" style="width:600px;color: #999">
                                <div>立即返还：</div>
                                <div style="margin-left: 56px">1、确定收货时立即返回 ；</div>
                                <div>自 定 义 ：</div>
                                <div style="margin-left: 56px">1、确认收货后按天数算出每天应返还的平均数值，若设置小于2天则立即发放全部;</div>
                                <div style="margin-left: 56px">2、{:t('余额')}和{:t('佣金')}为四舍五入后的保留两位小数平均数值</div>
                                <div style="margin-left: 56px">3、{:t('积分')}为四舍五入后的整数数值，最小为1，总{:t('积分')}奖励过小会导致发奖完成天数提前许多天;</div>
                            </div>
                        </div>
                        {/if}
                        {if getcustom('cashback_yongjin')}
                        <div class="layui-form-item" >
                            <label class="layui-form-label">抵扣佣金提现：</label>
                            <div class="layui-input-inline" style="width:250px">
                                <input type="radio" name="info[cashback_yongjin]" value="0" {if !$info['id'] || $info['cashback_yongjin']==0}checked{/if} title="关闭" />
                                <input type="radio" name="info[cashback_yongjin]" value="1" {if $info['cashback_yongjin']==1}checked{/if} title="开启" />
                            </div>
                            <div class="layui-form-mid layui-word-aux"> 注：开启后在佣金提现时要扣掉已经返现的钱并终止返现</div>
                        </div>
                        {/if}

                        <div class="layui-form-item">
                            <label class="layui-form-label">选择活动商品：</label>
                            <div class="layui-input-inline" style="width:500px">
                                <input type="radio" name="info[fwtype]" value="0" {if $info['fwtype']==0}checked{/if} title="所有商品" lay-filter="fwtype"/>
                                <input type="radio" name="info[fwtype]" value="1" {if $info['fwtype']==1}checked{/if} title="指定类目" lay-filter="fwtype"/>
                                <input type="radio" name="info[fwtype]" value="2" {if $info['fwtype']==2}checked{/if} title="指定商品" lay-filter="fwtype"/>
                                {if getcustom('yx_cashback_collage')}
                                    <input type="radio" name="info[fwtype]" value="3" {if $info['fwtype']==3}checked{/if} title="指定多人拼团" lay-filter="fwtype"/>
                                {/if}
                            </div>
                            <div class="fwtype1" style="clear:both;{if $info['fwtype']!=1}display:none{/if}">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:auto">
                                    <table id="setcategorydiv"  class="layui-table" style="width:500px">
                                        <thead>
                                        <tr>
                                            <th>分类ID</th>
                                            <th>分类名称</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        {if $categorydata}
                                        {foreach $categorydata as $k=>$ff}
                                        <tr class="categorylisttr"><td>{$ff.id}</td><td>{$ff.name}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delCategory(this,{$ff.id})">删除</button></td></tr>
                                        {/foreach}
                                        {/if}
                                        <tr id="categoryaddtr">
                                            <td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseCategory()">添加</button></td>
                                        </tr>
                                    </table>
                                    <input type="hidden" name="info[categoryids]" value="{$info.categoryids}"/>
                                </div>
                            </div>
                            <script>
                            var chooseCategoryLayer;
                            function showChooseCategory(){
                                chooseCategoryLayer = layer.open({type:2,title:'选择商品分类',content:"{:url('ShopCategory/choosecategory')}",area:['1000px','600px'],shadeClose:true});
                            }
                            function chooseCategory(fid,fname){
                                layer.close(chooseCategoryLayer);
                                var categoryids = [];
                                var isadd = 0;
                                $('.categorylisttr').each(function(){
                                    var thisfid = $(this).find('td:eq(0)').html();
                                    if(thisfid == fid){
                                        isadd = 1
                                        dialog('该分类已添加过了');
                                    }
                                    categoryids.push(thisfid)
                                })
                                if(isadd == 0){
                                    categoryids.push(fid)
                                    $("input[name='info[categoryids]']").val(categoryids.join(','));
                                    $('#categoryaddtr').before('<tr class="categorylisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delCategory(this,'+fid+')">删除</button></td></tr>');
                                }
                                console.log(categoryids)
                            }
                            function delCategory(obj,fid){
                                $(obj).parent().parent().remove();
                                var categoryids = [];
                                $('.categorylisttr').each(function(){
                                    categoryids.push($(this).find('td:eq(0)').html())
                                })
                                $("input[name='info[categoryids]']").val(categoryids.join(','));
                            }
                            </script>
                            <div class="fwtype2" style="clear:both;{if $info['fwtype']!=2}display:none{/if}">
                                <label class="layui-form-label"></label>
                                <div class="layui-input-inline" style="width:auto">
                                    <table id="setproductdiv"  class="layui-table" style="width:700px">
                                        <thead>
                                        <tr>
                                            <th>商品ID</th>
                                            <th>商品名称</th>

                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        {if $productdata}
                                        {foreach $productdata as $k=>$ff}
                                        <tr class="productlisttr">
                                            <td>{$ff.id}</td>
                                            <td>{$ff.name}</td>
                                            <td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delProduct(this,{$ff.id})">删除</button></td>
                                        </tr>
                                        {/foreach}
                                        {/if}
                                        <tr id="productaddtr">
                                            <td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseProduct()">添加</button></td>
                                        </tr>
                                    </table>
                                    <input type="hidden" name="info[productids]" value="{$info.productids}"/>
                                </div>
                            </div>
                            <script>
                            var cxtype = '{$info.type}';
                            var chooseProductLayer;
                            function showChooseProduct(){
                                var url = "{:url('ShopProduct/chooseproduct')}/hidebid/1";
                                {if getcustom('cashback_yongjin')}
                                url = "{:url('ShopProduct/chooseproduct')}";
                                {/if}
                                chooseProductLayer = layer.open({type:2,title:'选择商品',content:url,area:['1000px','600px'],shadeClose:true});
                            }
                            function choosepro(res){
                                var product = res.product
                                layer.close(chooseProductLayer);
                                var productids = [];
                                var isadd = 0;
                                $('.productlisttr').each(function(){
                                    var thisfid = $(this).find('td:eq(0)').html();
                                    if(thisfid == product.id){
                                        isadd = 1
                                        dialog('该商品已添加过了');
                                    }
                                    productids.push(thisfid)
                                })
                                if(isadd == 0){
                                    productids.push(product.id)
                                    $("input[name='info[productids]']").val(productids.join(','));
                                    $('#productaddtr').before('<tr class="productlisttr"><td>'+product.id+'</td><td>'+product.name+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delProduct(this,'+product.id+')">删除</button></td></tr>');
                                }
                                console.log(productids)
                            }
                            function delProduct(obj,fid){
                                $(obj).parent().parent().remove();
                                var productids = [];
                                $('.productlisttr').each(function(){
                                    productids.push($(this).find('td:eq(0)').html())
                                })
                                $("input[name='info[productids]']").val(productids.join(','));
                            }
                            </script>
                            {if getcustom('yx_cashback_collage')}
                            <div class="fwtype3" style="clear:both;{if $info['fwtype']!=3}display:none{/if}">
                                    <label class="layui-form-label"></label>
                                    <div class="layui-input-inline" style="width:auto">
                                        <table id="setproductdiv"  class="layui-table" style="width:700px">
                                            <thead>
                                            <tr>
                                                <th>拼团商品ID</th>
                                                <th>商品名称</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            {if $collagedata}
                                            {foreach $collagedata as $k=>$ff}
                                            <tr class="collagelisttr">
                                                <td>{$ff.id}</td>
                                                <td>{$ff.name}</td>
                                                <td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delCollage(this,{$ff.id})">删除</button></td>
                                            </tr>
                                            {/foreach}
                                            {/if}
                                            <tr id="collageaddtr">
                                                <td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseCollage()">添加</button></td>
                                            </tr>
                                        </table>
                                        <input type="hidden" name="info[collageids]" value="{$info.collageids}"/>
                                    </div>
                            </div>
                            <script>
                            var cxtype = '{$info.type}';
                            var chooseCollageLayer;
                            function showChooseCollage(){
                                chooseCollageLayer = layer.open({type:2,title:'选择商品',content:"{:url('CollageProduct/chooseproduct')}/hidebid/1",area:['1000px','600px'],shadeClose:true});
                            }
                            function choosecollage(res){
                                console.log(res)
                                var product = res
                                layer.close(chooseCollageLayer);
                                var collageids = [];
                                var isadd = 0;
                                $('.collagelisttr').each(function(){
                                    var thisfid = $(this).find('td:eq(0)').html();
                                    if(thisfid == product.id){
                                        isadd = 1
                                        dialog('该商品已添加过了');
                                    }
                                    collageids.push(thisfid)
                                })
                                if(isadd == 0){
                                    collageids.push(product.id)
                                    $("input[name='info[collageids]']").val(collageids.join(','));
                                    $('#collageaddtr').before('<tr class="collagelisttr"><td>'+product.id+'</td><td>'+product.name+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delCollage(this,'+product.id+')">删除</button></td></tr>');
                                }
                                console.log(collageids)
                            }
                            function delCollage(obj,fid){
                                $(obj).parent().parent().remove();
                                var collageids = [];
                                $('.collagelisttr').each(function(){
                                    collageids.push($(this).find('td:eq(0)').html())
                                })
                                $("input[name='info[collageids]']").val(productids.join(','));
                            }
                            </script>
                            {/if}
                        </div>
                        {if getcustom('yx_cashback_collage_moneyreturn')}
                        <div id="moneyreturn" {if !$info['fwtype'] || $info['fwtype']!=3}style="display:none"{/if}>
                            <div class="layui-form-item">
                                <label class="layui-form-label">拼团{:t('余额')}返还：</label>
                                <div class="layui-input-inline" style="width:320px">
                                    <input type="radio" name="info[team_moneyreturn]" value="0" {if $info['id'] && $info['team_moneyreturn']==0}checked{/if} title="关闭" />
                                    <input type="radio" name="info[team_moneyreturn]" value="1" {if !$info['id'] || $info['team_moneyreturn']==1}checked{/if} title="全都返还" />
                                    <input type="radio" name="info[team_moneyreturn]" value="2" {if $info['id'] && $info['team_moneyreturn']==2}checked{/if} title="仅团长返还" />
                                </div>
                                <div class="layui-form-mid layui-word-aux"> 关闭则拼团购买使用{:t('余额')}支付的订单都不返还</div>
                            </div>
                            <div class="layui-form-item" >
                                <label class="layui-form-label">单购{:t('余额')}返还：</label>
                                <div class="layui-input-inline" style="width:320px">
                                    <input type="radio" name="info[alone_moneyreturn]" value="0" {if $info['id'] && $info['alone_moneyreturn']==0}checked{/if} title="关闭" />
                                    <input type="radio" name="info[alone_moneyreturn]" value="1" {if !$info['id'] || $info['alone_moneyreturn']==1}checked{/if} title="开启" />
                                </div>
                                <div class="layui-form-mid layui-word-aux"> 关闭则单独购买使用{:t('余额')}支付的订单不返还</div>
                            </div>
                        </div>
                        {/if}
                        {if getcustom('plug_tengrui')}
                        <div class="layui-form-item">
                            <label class="layui-form-label">认证{:t('会员')}：</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="info[is_rzh]" value="0" {if !$info['id'] || $info['is_rzh']==0}checked{/if} title="否"/>
                                <input type="radio" name="info[is_rzh]" value="1" {if $info['id'] && $info['is_rzh']==1}checked{/if} title="是"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:t('会员')}关系：</label>
                            <div class="layui-input-inline" style="width:500px">
                            <input type="radio" name="info[relation_type]" value="-1" {if !$info['id'] || $info['relation_type']==-1}checked{/if} title="所有"/>
                                <input type="radio" name="info[relation_type]" value="0" {if $info['id'] && $info['relation_type']==0}checked{/if} title="业主"/>
                                <input type="radio" name="info[relation_type]" value="1" {if $info['id'] && $info['relation_type']==1}checked{/if} title="家属"/>
                                <input type="radio" name="info[relation_type]" value="2" {if $info['id'] && $info['relation_type']==2}checked{/if} title="租户"/>
                                <input type="radio" name="info[relation_type]" value="3" {if $info['id'] && $info['relation_type']==3}checked{/if} title="买断"/>
                                <input type="radio" name="info[relation_type]" value="4" {if $info['id'] && $info['relation_type']==4}checked{/if} title="租用"/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">一户仅限一次：</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="info[house_status]" value="0" {if $info['id'] && $info['house_status']==0}checked{/if} title="否"/>
                                <input type="radio" name="info[house_status]" value="1" {if !$info['id'] || $info['house_status']==1}checked{/if} title="是"/>
                            </div>
                            <div class="layui-form-mid layui-word-aux" style="margin-left:10px;">需是认证用户，且同一个小区的同一户只限一人购买，即一户仅限一次</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">授权小区：</label>
                            <div class="layui-input-inline" style="width:500px">
                                <input type="radio" name="info[group_status]" value="0" {if $info['group_status']==0}checked{/if} title="关闭" lay-filter="group_status"/>
                                <input type="radio" name="info[group_status]" value="1" {if $info['group_status']==1}checked{/if} title="开启" lay-filter="group_status"/>
                            </div>
                            <div class="group_status1 fwtypeExtend" style="clear:both;{if $info['group_status']!=1}display:none{/if}">
                                <label class="layui-form-label" style="width:100px"></label>
                                <div class="layui-input-inline" style="width:auto">
                                    <table id="setgroupdiv"  class="layui-table" style="width:500px">
                                        <thead>
                                        <tr>
                                            <th>小区ID</th>
                                            <th>小区名称</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        {if $groupdata}
                                        {foreach $groupdata as $gk=>$gv}
                                        <tr class="grouplisttr"><td>{$gv.id}</td><td>{$gv.fullName}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delGroup(this,{$gv.id})">删除</button></td></tr>
                                        {/foreach}
                                        {/if}
                                        <tr id="groupaddtr">
                                            <td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseGroup()">添加</button></td>
                                        </tr>
                                    </table>
                                    <input type="hidden" name="info[group_ids]" value="{$info.group_ids}"/>
                                </div>
                            </div>
                            <script>
                            var chooseGroupLayer;
                            function showChooseGroup(){
                                chooseGroupLayer = layer.open({type:2,title:'选择分组',content:"{:url('MemberTrGroup/choosegroup')}",area:['1000px','600px'],shadeClose:true});
                            }
                            function chooseGroup(fid,fname){
                                layer.close(chooseGroupLayer);
                                var group_ids = [];
                                var isadd = 0;
                                $('.grouplisttr').each(function(){
                                    var thisfid = $(this).find('td:eq(0)').html();
                                    if(thisfid == fid){
                                        isadd = 1
                                        dialog('该分组已添加过了');
                                    }
                                    group_ids.push(thisfid)
                                })
                                if(isadd == 0){
                                    group_ids.push(fid)
                                    $("input[name='info[group_ids]']").val(group_ids.join(','));
                                    $('#groupaddtr').before('<tr class="grouplisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delGroup(this,'+fid+')">删除</button></td></tr>');
                                }
                                console.log(group_ids)
                            }
                            function delGroup(obj,fid){
                                $(obj).parent().parent().remove();
                                var group_ids = [];
                                $('.grouplisttr').each(function(){
                                    group_ids.push($(this).find('td:eq(0)').html())
                                })
                                $("input[name='info[group_ids]']").val(group_ids.join(','));
                            }
                            </script>
                        </div>
                        {/if}
                        <div class="layui-form-item">
                            <label class="layui-form-label">参与条件：</label>
                            <div class="layui-input-inline" style="width:600px">
                                <input type="checkbox" name="info[gettj][]" value="-1" title="所有人" {if in_array('-1',$info['gettj'])}checked{/if}/>
                                <!-- <input type="checkbox" name="info[gettj][]" value="0" title="关注用户" {if in_array('0',$info['gettj'])}checked{/if}/> -->
                                {foreach $memberlevel as $v}
                                <input type="checkbox" name="info[gettj][]" value="{$v.id}" title="{$v.name}" {if in_array($v['id'],$info['gettj'])}checked{/if}/>
                                {/foreach}
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">开始时间：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="info[starttime]" autocomplete="off" value="{$info.starttime}" lay-verify="required" lay-verType="tips" class="layui-input" id="starttime">
                            </div>
                            <div class="layui-form-mid layui-word-aux">活动开始时间</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">结束时间：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="info[endtime]" autocomplete="off" value="{$info.endtime}" lay-verify="required" lay-verType="tips" class="layui-input" id="endtime">
                            </div>
                            <div class="layui-form-mid layui-word-aux">活动结束时间</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">序号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="info[sort]" value="{$info.sort}" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">用于排序,越大越靠前</div>
                        </div>
                        <div class="layui-form-item">
							<label class="layui-form-label"></label>
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
    </div>
  </div>
    {include file="public/js"/}
    <script>
    layui.form.on('radio(group_status)',function(data){
        if(data.value == 1){
            $('.group_status1').show();
        }else{
            $('.group_status1').hide();
        }
    })
    layui.form.on('radio(fwtype)',function(data){
        if(data.value==1){
            $('.fwtype1').show();
            $('.fwtype2').hide();
            $('.fwtype3').hide();
            $('#moneyreturn').hide();

        }else if(data.value==2){
            $('.fwtype1').hide();
            $('.fwtype2').show();
            $('.fwtype3').hide();
        }else if(data.value==3){
            $('.fwtype1').hide();
            $('.fwtype2').hide();
            $('.fwtype3').show();
            $('#moneyreturn').show();
        }else{
            $('.fwtype1').hide();
            $('.fwtype2').hide();
            $('.fwtype3').hide();
            $('#moneyreturn').hide();
        }
    })
    {if getcustom('yx_cashback_time')}
    layui.form.on('radio(return_type)',function(data){
        if(data.value==1){
            $('#return_day').show();
        }else{
            $('#return_day').hide();
        }
    })
    {/if}
    layui.laydate.render({
        elem: '#starttime'
        ,type: 'datetime'
        ,range: false,
        trigger: 'click'
    });
    layui.laydate.render({
        elem: '#endtime'
        ,type: 'datetime'
        ,range: false,
        trigger: 'click'
    });

    layui.form.on('submit(formsubmit)', function(obj){
        console.log(obj)
        var field = obj.field
        var index = layer.load();
        $.post("{:url('save')}",field,function(data){
            layer.close(index);
            dialog(data.msg,data.status);
            if(data.status == 1){
                setTimeout(function(){
                    parent.layer.closeAll();
                    parent.tableIns.reload()
                },1000)
            }
        })
    })
  </script>
    {include file="public/copyright"/}
</body>
</html>